<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><?php echo C('site_name');?></title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">

<script type="text/javascript" src="<?php echo STATICS;?>/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<?php echo STATICS;?>/js/jquery.form.min.js"></script>
<script type="text/javascript" src="<?php echo STATICS;?>/layui/lay/dest/layui.all.js"></script>
<script type="text/javascript" src="<?php echo STATICS;?>/js/regExp.js"></script>
<script type="text/javascript" src="<?php echo RES;?>/js/common.js"></script>

<link rel="stylesheet" href="<?php echo STATICS;?>/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="<?php echo STATICS;?>/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="<?php echo RES;?>/css/global.css" media="all">
<link rel="stylesheet" href="<?php echo RES;?>/css/uploadProgress.css" media="all">

</head>
<body>


<div class="admin-main">

	<blockquote class="layui-elem-quote">
		<a href="<?php echo U('Goods/add');?>" class="layui-btn layui-btn-small">
			<i class="layui-icon">&#xe608;</i> 添加
		</a>
		
		<button class="layui-btn layui-btn-small" onclick="window.location.reload();">
			<i class="fa fa-refresh"></i> 刷新
		</button>

		<button class="layui-btn layui-btn-small layui-btn-danger" id="delBtn">
			<i class="fa fa-close"></i> 删除
		</button>

		<div class="search">
			<form class="layui-form" method="post" action="<?php echo U('Goods/index');?>">
			<div class="layui-input-inline">
			<select name="path" id="path">
				<option value="0">全部</option>
				<?php if(is_array($sclass)): $i = 0; $__LIST__ = $sclass;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value='<?php echo ($vo['path']); ?>'><?php for($i=0; $i<$vo['count']*2; $i++){ echo '&nbsp;&nbsp;'; } echo ($vo['name']); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
			</select>
			</div>
			<div class="layui-input-inline">
			<input type="text" name="keyword" class="layui-input layui-btn-small">
			</div>
			<button type="submit" class="layui-btn" lay-submit=""><i class="layui-icon">&#xe615;</i> 搜索</button>
			<a href="<?php echo U('Goods/index');?>" class="layui-btn layui-btn-primary">重置</a>
			</form>
		</div>
	</blockquote>

	<fieldset class="layui-elem-field">
		<legend>数据列表</legend>
		<div class="layui-field-box">
			<form id="ajaxForm" method="post" action="<?php echo U('Goods/del');?>">
			<table class="site-table table-hover">
				<thead>
					<tr>
						<th><input type="checkbox" id="selected-all"></th>								
						<th>名称</th>
						<th>分类</th>
						<th>图片</th>
						<th>规格</th>
						<th>推荐</th>
						<th>状态</th>
						<th>排序值</th>
						<th>添加日期</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
						<td><input type="checkbox" name="selectedids[]" value="<?php echo ($vo["id"]); ?>"></td>
						<td><a href="<?php echo U('Goods/edit' , array('id'=>$vo['id']));?>" alt="<?php echo ($vo["face"]); ?>" title="<?php echo ($vo["name"]); ?>"><?php echo ($vo["name"]); ?></a></td>
						<td><?php echo ($cate[$vo['cid']]); ?></td>
						<td><img src="<?php echo ($vo["face"]); ?>" style="height:40px" class="preview" alt="<?php echo ($vo["face"]); ?>" title="<?php echo ($vo["name"]); ?>"></td>		
						<td><?php echo ($vo["intr"]); ?></td> 
						<td><?php if(($vo["index"]) == "0"): ?>否<?php else: ?><font color="red">是</font><?php endif; ?></td>	
						<td><?php if(($vo["show"]) == "1"): ?>显示<?php else: ?><font color="red">隐藏</font><?php endif; ?></td>	
						<td><?php echo ($vo["sort"]); ?></td>
						<td><?php echo (date('Y-m-d H:i:s',$vo["createTime"])); ?></td>
						<td>
							<a href="<?php echo U('Goods/edit' , array('id'=>$vo['id']));?>" class="layui-btn layui-btn-mini">编辑</a>
						</td>
					</tr><?php endforeach; endif; else: echo "" ;endif; ?>						
				</tbody>
			</table>
			<input type="hidden" name="mpath" id="mpath">
			</form>
		</div>
	</fieldset>
	<div class="admin-table-page">
		<div id="page" class="page"><?php echo ($page); ?></div>
	</div>
</div>

<script type="text/javascript">
$("#path").val("<?php echo ($path); ?>");

$("#moveBtn").click(function(){
	_html = '<div style="padding:20px;">';
	_html += '<select name="pathSel" id="pathSel" style="padding:4px 0" onchange="setPath()">';
	<?php if(is_array($sclass)): $i = 0; $__LIST__ = $sclass;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>_html += '<option value="<?php echo ($vo['id']); ?>,<?php echo ($vo['path']); ?>"><?php for($i=0; $i<$vo['count']*2; $i++){ echo '&nbsp;&nbsp;'; } echo ($vo['name']); ?></option>';<?php endforeach; endif; else: echo "" ;endif; ?>
	_html += '</select>';
	_html += '</div>';
	layer.open({
		type: 1,
		title:'批量移动',
		area: ['420px', '200px'], //宽高
		btn: ['确定'],
		content: _html,
		yes:function(index){			 
			layer.close(index);
			$('#ajaxForm').attr('action', '<?php echo U('Goods/move');?>');
			$('#ajaxForm').submit();
		}
	});
});

function setPath(){
	$("#mpath").val($("#pathSel").val());
}
</script>
		

</body>
</html>